
require "lfs"

function getpathes(rootpath, pathes)
    pathes = pathes or {}
    for entry in lfs.dir(rootpath) do
        if entry ~= '.' and entry ~= '..' then
            local path = rootpath .. '\\' .. entry
            local attr = lfs.attributes(path)
            assert(type(attr) == 'table')

            if attr.mode == 'directory' then
                getpathes(path, pathes)
            else
                table.insert(pathes, path)
            end
        end
    end
    return pathes
end


local paths = getpathes("D:\\tmp")

for k,v in pairs(paths) do

	print(v)
end


local f = io.popen("dir \"C:\\users\\\"")
if f then
    print(f:read("*a"))
else
    print("failed to read")
end


local t = { a = { b = 1}  }

local ta = t.a

local tab = t.a.b

tab = 2

print(tab)

print(ta.b)

print(t.a.b)


function getFileName(filename)
    --return string.match(filename, "(.+)/[^/]*%.%w+$")
	return string.match(filename, ".+/([^/]-)%.%w+$") -- *nix system
end

print(getFileName("d:/c/name.txt.txt"))
